package com.data;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.com.R;

public class myadapter extends ArrayAdapter<User> {

	ArrayList<User> ut;
	Context c;

	static class ViewHolder {
		public TextView text, text1, text2;
		
	}

	public myadapter(Context context, int textViewResourceId,
			ArrayList<User> objects) {
		super(context, textViewResourceId, objects);
		ut = objects;
		c = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return super.getCount();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) c
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.raw, parent, false);
		
		ViewHolder viewHolder = new ViewHolder();
		viewHolder.text = (TextView) rowView.findViewById(R.id.textViewname);
		viewHolder.text1 = (TextView) rowView.findViewById(R.id.textViewnumber);
		viewHolder.text2 = (TextView) rowView.findViewById(R.id.textViewemail);
		rowView.setTag(viewHolder);

		viewHolder.text.setText("Name -->"+ut.get(position).getName().toString());
		viewHolder.text1.setText("Number -->"+ut.get(position).getNumber().toString());
		viewHolder.text2.setText("Email -->"+ut.get(position).getEmail().toString());
		//ViewHolder ViewHolder = (ViewHolder) rowView.getTag(); 

		

		return rowView;
	}

}
